package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("AdminController")
@Slf4j
@RequestMapping("/admin/shop")
@Api("店铺营业状态")
public class ShopController {
    @Autowired
    private ShopService shopService;

    @GetMapping("/status")
    @ApiOperation("获取店铺状态")
    public Result<Integer> getStatus() {
        Integer status= shopService.getStatus();
        return Result.success(status);
    }

    @PutMapping("{status}")
    @ApiOperation("设置营业状态")
    public Result updateStatus(@PathVariable("status") Integer status) {
        log.info("设置营业状态为:{}",status);
        shopService.updateStatus(status);
        return Result.success();
    }


}
